package me.keiwu.user.domain;

import lombok.Data;
import org.hibernate.annotations.ColumnDefault;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Created by kei on 02/02/2018.
 */
@Data
@Entity
@Table(uniqueConstraints = {
        @UniqueConstraint(name = "uidx_owner_commenter", columnNames = {"owner", "commenter"})
})
public class Comment {

    @Id
    @GeneratedValue
    private Long id;

    private Long owner;

    private Long commenter;

    private String avatar;

    private String nickName;

    private String lastMsg;

    private Integer time;

    @ColumnDefault(value = "0")
    @Column(nullable = false, columnDefinition = "TINYINT", length = 1)
    private boolean paid = false;

}
